library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.3 ✓ purrr 0.3.4
## ✓ tibble 3.0.5 ✓ dplyr 1.0.3
## ✓ tidyr 1.1.2 ✓ stringr 1.4.0
## ✓ readr 1.4.0 ✓ forcats 0.5.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(downloader)
library(readxl)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
MData <- tempfile()
download("https://raw.githubusercontent.com/fivethirtyeight/data/master/fandango/fandango_score_comparison.csv", MData, mode = "wb")
MovieData <- read_csv(MData)
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## .default = col_double(),
## FILM = col_character()
## )
## ℹ Use `spec()` for the full column specifications.
str(MovieData)
## tibble [146 × 22] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
## $ FILM : chr [1:146] "Avengers: Age of Ultron (2015)" "Cinderella (2015)" "Ant-Man (2015)" "Do You Believe? (2015)" ...
## $ RottenTomatoes : num [1:146] 74 85 80 18 14 63 42 86 99 89 ...
## $ RottenTomatoes_User : num [1:146] 86 80 90 84 28 62 53 64 82 87 ...
## $ Metacritic : num [1:146] 66 67 64 22 29 50 53 81 81 80 ...
## $ Metacritic_User : num [1:146] 7.1 7.5 8.1 4.7 3.4 6.8 7.6 6.8 8.8 8.5 ...
## $ IMDB : num [1:146] 7.8 7.1 7.8 5.4 5.1 7.2 6.9 6.5 7.4 7.8 ...
## $ Fandango_Stars : num [1:146] 5 5 5 5 3.5 4.5 4 4 4.5 4.5 ...
## $ Fandango_Ratingvalue : num [1:146] 4.5 4.5 4.5 4.5 3 4 3.5 3.5 4 4 ...
## $ RT_norm : num [1:146] 3.7 4.25 4 0.9 0.7 3.15 2.1 4.3 4.95 4.45 ...
## $ RT_user_norm : num [1:146] 4.3 4 4.5 4.2 1.4 3.1 2.65 3.2 4.1 4.35 ...
## $ Metacritic_norm : num [1:146] 3.3 3.35 3.2 1.1 1.45 2.5 2.65 4.05 4.05 4 ...
## $ Metacritic_user_nom : num [1:146] 3.55 3.75 4.05 2.35 1.7 3.4 3.8 3.4 4.4 4.25 ...
## $ IMDB_norm : num [1:146] 3.9 3.55 3.9 2.7 2.55 3.6 3.45 3.25 3.7 3.9 ...
## $ RT_norm_round : num [1:146] 3.5 4.5 4 1 0.5 3 2 4.5 5 4.5 ...
## $ RT_user_norm_round : num [1:146] 4.5 4 4.5 4 1.5 3 2.5 3 4 4.5 ...
## $ Metacritic_norm_round : num [1:146] 3.5 3.5 3 1 1.5 2.5 2.5 4 4 4 ...
## $ Metacritic_user_norm_round: num [1:146] 3.5 4 4 2.5 1.5 3.5 4 3.5 4.5 4.5 ...
## $ IMDB_norm_round : num [1:146] 4 3.5 4 2.5 2.5 3.5 3.5 3.5 3.5 4 ...
## $ Metacritic_user_vote_count: num [1:146] 1330 249 627 31 88 34 17 124 62 54 ...
## $ IMDB_user_vote_count : num [1:146] 271107 65709 103660 3136 19560 ...
## $ Fandango_votes : num [1:146] 14846 12640 12055 1793 1021 ...
## $ Fandango_Difference : num [1:146] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...
## - attr(*, "spec")=
## .. cols(
## .. FILM = col_character(),
## .. RottenTomatoes = col_double(),
## .. RottenTomatoes_User = col_double(),
## .. Metacritic = col_double(),
## .. Metacritic_User = col_double(),
## .. IMDB = col_double(),
## .. Fandango_Stars = col_double(),
## .. Fandango_Ratingvalue = col_double(),
## .. RT_norm = col_double(),
## .. RT_user_norm = col_double(),
## .. Metacritic_norm = col_double(),
## .. Metacritic_user_nom = col_double(),
## .. IMDB_norm = col_double(),
## .. RT_norm_round = col_double(),
## .. RT_user_norm_round = col_double(),
## .. Metacritic_norm_round = col_double(),
## .. Metacritic_user_norm_round = col_double(),
## .. IMDB_norm_round = col_double(),
## .. Metacritic_user_vote_count = col_double(),
## .. IMDB_user_vote_count = col_double(),
## .. Fandango_votes = col_double(),
## .. Fandango_Difference = col_double()
## .. )
head(MovieData)
## # A tibble: 6 x 22
## FILM RottenTomatoes RottenTomatoes_… Metacritic Metacritic_User IMDB
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Aven… 74 86 66 7.1 7.8
## 2 Cind… 85 80 67 7.5 7.1
## 3 Ant-… 80 90 64 8.1 7.8
## 4 Do Y… 18 84 22 4.7 5.4
## 5 Hot … 14 28 29 3.4 5.1
## 6 The … 63 62 50 6.8 7.2
## # … with 16 more variables: Fandango_Stars <dbl>, Fandango_Ratingvalue <dbl>,
## # RT_norm <dbl>, RT_user_norm <dbl>, Metacritic_norm <dbl>,
## # Metacritic_user_nom <dbl>, IMDB_norm <dbl>, RT_norm_round <dbl>,
## # RT_user_norm_round <dbl>, Metacritic_norm_round <dbl>,
## # Metacritic_user_norm_round <dbl>, IMDB_norm_round <dbl>,
## # Metacritic_user_vote_count <dbl>, IMDB_user_vote_count <dbl>,
## # Fandango_votes <dbl>, Fandango_Difference <dbl>
tail(MovieData)
## # A tibble: 6 x 22
## FILM RottenTomatoes RottenTomatoes_… Metacritic Metacritic_User IMDB
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Insi… 98 90 94 8.9 8.6
## 2 Mr. … 87 78 67 7.9 7.4
## 3 '71 … 97 82 83 7.5 7.2
## 4 Two … 97 78 89 8.8 7.4
## 5 Gett… 100 81 90 7.3 7.8
## 6 Kumi… 87 63 68 6.4 6.7
## # … with 16 more variables: Fandango_Stars <dbl>, Fandango_Ratingvalue <dbl>,
## # RT_norm <dbl>, RT_user_norm <dbl>, Metacritic_norm <dbl>,
## # Metacritic_user_nom <dbl>, IMDB_norm <dbl>, RT_norm_round <dbl>,
## # RT_user_norm_round <dbl>, Metacritic_norm_round <dbl>,
## # Metacritic_user_norm_round <dbl>, IMDB_norm_round <dbl>,
## # Metacritic_user_vote_count <dbl>, IMDB_user_vote_count <dbl>,
## # Fandango_votes <dbl>, Fandango_Difference <dbl>
NewData <- MovieData %>%
select(FILM, RT_norm, Metacritic_norm, IMDB_norm, Fandango_Ratingvalue) %>%
pivot_longer(2:5, names_to = "websites", values_to = "ratings") %>%
select(FILM, websites, ratings)
view(NewData)
f20_ratings <- head(NewData, n = 20)
view(f20_ratings)
ggplot(f20_ratings, aes(x = ratings, y = websites, color = FILM)) +
geom_point() +
theme_bw()

moviegraph <- ggplot(f20_ratings, aes(x = websites, y = ratings, fill = websites, text = websites)) +
geom_col(position = "dodge") +
facet_wrap(~ FILM, nrow = 1) +
scale_fill_discrete(name = "Websites", labels = c("Fandango", "IMDB", "Metracritic", "Rotton Tomatoes")) +
scale_x_discrete(name = "Type of Websites", labels = c(" ", " ", " ", " ")) +
scale_fill_brewer(palette = "Set2") +
labs(x = "Type of Websites",
y = "Ratings",
title = "Comparing Different Movie Ranking Sites",
caption = "I used a Column graph with a facet wrap seperating the different types of movies. \nI did those so the user would be able to make direct comparisons within the movie ratings itself. \nFrom this graph, we can see that Fandago has the highest rankings for each movie, followed by IMDB. \nMetacritic and Rotton Tomatos switch between each movie.") +
theme_bw()
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
ggplotly(moviegraph, tooltip = "text")